/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package traitements;

import bdd.QueriesCommandes;
import beans.CmdCommande;
import beans.CmdDetailCmde;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author cdi207
 */
public class Commande implements Serializable {

    ArrayList<CmdCommande> commandes;
    ArrayList<CmdDetailCmde> detailCmde;

    public Commande() {
        commandes = new ArrayList();
    }

    public ArrayList<CmdCommande> listeCommandes(int cliId) {

        QueriesCommandes qc;
        try {
            qc = new QueriesCommandes();
            commandes = qc.cmdAfficherCommandes(cliId);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Commande.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(Commande.class.getName()).log(Level.SEVERE, null, ex);
        }




        return commandes;
    }

    public ArrayList<CmdDetailCmde> detailCommandes() {


        QueriesCommandes qc;
        try {
            qc = new QueriesCommandes();
            detailCmde = qc.cmdAfficherLignesCmde(14);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Commande.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(Commande.class.getName()).log(Level.SEVERE, null, ex);
        }


        return detailCmde;
    }
}
